//
//  EssentialDetailViewController.m
//  Menu
//
//  Created by dllo on 15/7/8.
//  Copyright (c) 2015年 lijiangang. All rights reserved.
//

#import "EssentialDetailViewController.h"

@interface EssentialDetailViewController ()

@end

@implementation EssentialDetailViewController

- (void)dealloc
{
    [_essentialDView release];
    [super dealloc];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.essentialDView = [[EssentialDetailView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.essentialDView.essentialLabel.text = [NSString stringWithFormat:@"        %@",self.essentialDetail];
    [self.essentialDView.essentialImgView sd_setImageWithURL:[NSURL URLWithString:self.imgUrl]];
    
    CGFloat LabelHeight = [[self class] heightForLabel:self.essentialDView.essentialLabel.text Width:self.essentialDView.essentialLabel.frame.size.width*WIDTH Height:1000*HEIGHT Font:17
                           ];
    CGRect LabelFrame = self.essentialDView.essentialLabel.frame;
    LabelFrame.size.height = LabelHeight;
    self.essentialDView.essentialLabel.frame = LabelFrame;
    [self.view addSubview:self.essentialDView];
    [_essentialDView release];
    
}


+(CGFloat)heightForLabel:(NSString *)content Width:(CGFloat)width Height:(CGFloat)height Font:(CGFloat)font
{
    CGSize size = CGSizeMake(width, height);
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObject:[UIFont systemFontOfSize:font] forKey:NSFontAttributeName];
    CGRect frame = [content boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return frame.size.height;
}



































- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
